﻿@{ 
   var controller = ViewContext.RouteData.Values["controller"] as string ?? "Home";
   var currentPage = (controller).ToLower();
}

<nav class="top-bar">
    <div class="row">
    <ul>
        <li class="name"><a href="@Url.Action("Index", "Home")">@ViewBag.CompanyName</a></li>
        <li class="toggle-topbar"><a href="#"></a></li>
        <li class="">
            <div class="searchbar">
                <form id="Search" action="/Search/Results" method="post">
                    <input id="omnisearch" type="text" name="q" placeholder="Search..." />
                </form>
                <i class="icon-search"></i>
            </div>
        </li>
    </ul>
    <section class="link-bar">
    <ul class="right">
        @*<li class="@if(currentPage == "home"){<text>active</text>}">
            @Html.ActionLink(" Dashboard",   "Index",    "Home",     null, new { @class = "icon-home "  + (currentPage == "home" ? "active" : "") })
        </li>*@
        <li class="@if(currentPage == "client"){<text>active</text>}">
            @Html.ActionLink(" Clients",     "Index",    "Client",   null, new { @class = "icon-user "       + (currentPage == "client" ? "active" : "") })
        </li>
        <li class="@if(currentPage == "event"){<text>active</text>}">@Html.ActionLink(" Events",      "Index",    "Event",    null, new { @class = "icon-calendar "   + (currentPage == "event" ? "active" : "") })</li>
        <li class="@if(currentPage == "Location"){<text>active</text>}">@Html.ActionLink(" Locations",     "Index",    "Location",   null, new { @class = "icon-location "       + (currentPage == "location" ? "active" : "") })</li>
        <li class="hide-for-medium-down @if(currentPage == "Report"){<text>active</text>}">@Html.ActionLink(" Reports",     "Index",    "Report",   null, new { @class = "icon-bars "       + (currentPage == "report" ? "active" : "") })</li>
        <li class="has-dropdown @if(currentPage == "setting"){<text>active</text>}">
            <a href="@Url.Action("Index", "Setting")"><img style="margin-top: 20px; border-radius: 50%" src="@string.Format(@"https://www.gravatar.com/avatar/{0}?s={1}&d=mm",ViewBag.MainGravatar, 40)"/></a>
            <ul class="dropdown">
                <li><label style="text-transform: none;">@ViewBag.Username</label></li>
                @if (Roles.IsUserInRole("Administrators"))
                {
                    <li><a href="@Url.Action("Index", "Setting")">System Settings</a></li>
                }
                <li>@Html.ActionLink("Log Out", "LogOff", "Account")</li>
            </ul>
        </li>
    </ul>
    </section>
    </div>
</nav>
